package definite.Guide.Book.CoreSwingComponent.JLabelClass;

import java.awt.EventQueue;
import java.awt.event.KeyEvent;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;

public class JLabelSample extends JFrame {

	private JPanel contentPane;
	private JTextField textField;
	private JLabel label;
	private JLabel lblUsername;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					JLabelSample frame = new JLabelSample();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public JLabelSample() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);

		textField = new JTextField();
		textField.setBounds(147, 72, 277, 50);
		contentPane.add(textField);
		textField.setColumns(10);

		label = new JLabel();
		label.setText("UserName :");
		label.setDisplayedMnemonic(KeyEvent.VK_U);
		label.setLabelFor(textField);
		contentPane.add(label);

		lblUsername = new JLabel("UserName :");
		lblUsername.setLabelFor(textField);
		lblUsername.setDisplayedMnemonic(KeyEvent.VK_U);
		lblUsername.setBounds(38, 33, 95, 32);
		contentPane.add(lblUsername);
	}
}
